import { defineStore } from "pinia";
import {ref} from "vue";

export const useSearchStore = defineStore("search", ()=>{
 
    const searchOpen = ref(false)
    const fromPage = ref("/")

    function  toggleSearch(){
        searchOpen.value = !searchOpen.value 
    }

    function openSearch(){
        searchOpen.value = true
    }

    function closeSearch(){
        searchOpen.value = false
    }

    function   setFromPage(payload){
        fromPage.value = payload
    }

    return {
        searchOpen,
        fromPage,
        toggleSearch,
        openSearch,
        closeSearch,
        setFromPage
    }
});
